<template>
	<view>
		<uni-nav-bar statusBar :border='false' color="#fff" fixed :backgroundColor='backgroundColor'>
			<block slot="left">
				<view class="flex-row-flex-start">
					<image class="logo" src="/static/common/logo.png" mode=""></image>
					<view class="topTitle">
					猩猩地堡
					</view>

				</view>
			</block>
		</uni-nav-bar>
		<view class="topView">
			</view>
			<view class="infoView" style="margin-top: -300rpx;">
				<view class="flex-column-center" >
					<image class="header" :src="userinfo.avatar" mode=""></image>
					<view class="name">
						{{userinfo.nickname}}
					</view>
				</view>
				<view class="item1 flex-row-space-between">
					<view class="left">
						性别
					</view>
					<view class="right flex-row-flex-end">
						男
						<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
					</view>
				</view>
				<view class="line">
					
				</view>
				<view class="item1 flex-row-space-between">
					<view class="left">
						手机号
					</view>
					<view class="right flex-row-flex-end">
						{{userinfo.mobile}}
						
					</view>
				</view>
				<view class="line">
					
				</view>
				<view class="item1 flex-row-space-between">
					<view class="left">
						所属部门
					</view>
					<view class="right flex-row-flex-end">
						{{userinfo.store_name}}
						<!-- <uni-icons type="right" color="#B7B7B7" size="20"></uni-icons> -->
					</view>
				</view>
				<view class="line">
					
				</view>
				<view class="item1 flex-row-space-between">
					<view class="left">
						身份
					</view>
					<view class="right flex-row-flex-end">
						<text v-if="userinfo.group_id==1">管理员</text>
						<text v-if="userinfo.group_id==2">店长</text>
						<text v-if="userinfo.group_id==3">员工</text>
					</view>
				</view>
				<view v-if="userinfo.group_id==2" class="line">
					
				</view>
				<view v-if="userinfo.group_id==2" @click="toUrl('employeeManagement')" class="item1 flex-row-space-between">
					<view class="left">
					员工管理
					</view>
					<view class="right flex-row-flex-end">
						
						<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
					</view>
				</view>
				<view v-if="userinfo.group_id==1" class="line">
					
				</view>
				<view v-if="userinfo.group_id==1" @click="toUrl('storeList')" class="item1 flex-row-space-between">
					<view class="left">
					门店列表
					</view>
					<view class="right flex-row-flex-end">
						
						<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
					</view>
				</view>
				<view v-if="userinfo.group_id==1||userinfo.group_id==2" class="line">
					
				</view>
				<view v-if="userinfo.group_id==1||userinfo.group_id==2" @click="settingsClick()" class="item1 flex-row-space-between">
					<view class="left">
					打卡设置
					</view>
					<view class="right flex-row-flex-end">
						
						<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
					</view>
				</view>
				<view v-if="userinfo.group_id==1||userinfo.group_id==2" class="line">
					
				</view>
				<view v-if="userinfo.group_id==1||userinfo.group_id==2" @click="toUrl('qrcode')" class="item1 flex-row-space-between">
					<view class="left">
					打卡二维码
					</view>
					<view class="right flex-row-flex-end">
						
						<uni-icons type="right" color="#B7B7B7" size="20"></uni-icons>
					</view>
				</view>
			
		</view>
		<view @click="buttonClick()" class="button flex-column-center">
			退出登录
		</view>
	<u-tabbar v-if="userinfo.group_id==3"  :safeAreaInsetBottom="true" :zIndex='999' activeColor='#157EFE' inactiveColor='#999999' :value="value"
		:fixed="true" :placeholder="true">
		<u-tabbar-item  text="签到" @click="tabbarClick" :name='1'>
			<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabbar/2.png"></image>
			<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabbar/1.png"></image>
		</u-tabbar-item>
		<u-tabbar-item  text="记录" @click="tabbarClick" :name='2'>
			<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabbar/6.png"></image>
			<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabbar/5.png"></image>
		</u-tabbar-item>
		<u-tabbar-item text="我的" @click="tabbarClick" :name='3'>
			<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabbar/8.png"></image>
			<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabbar/7.png"></image>
		</u-tabbar-item>
	</u-tabbar>
	<u-tabbar v-else :safeAreaInsetBottom="true" :zIndex='999' activeColor='#157EFE' inactiveColor='#999999' :value="value"
		:fixed="true" :placeholder="true">
		<u-tabbar-item  text="考勤" @click="tabbarClick" :name='1'>
			<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabbar/4.png"></image>
			<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabbar/3.png"></image>
		</u-tabbar-item>
		<u-tabbar-item text="我的" @click="tabbarClick" :name='3'>
			<image class="u-page__item__slot-icon" slot="active-icon" src="/static/tabbar/8.png"></image>
			<image class="u-page__item__slot-icon" slot="inactive-icon" src="/static/tabbar/7.png"></image>
		</u-tabbar-item>
	
	</u-tabbar>


	</view>
</template>

<script>
	import {
		mapActions,
		mapState
	} from "vuex";
	import {
		forum_list,
	} from '@/api/index.js'
	export default {
		components: {},
		computed: {

		},
		data() {
			return {
				value:3,
				userinfo:{},
				list: [],
				title: "",
				backgroundColor: 'ffffff00',
				list: [],
				data: {}

			}
		},
		computed: {
			...mapState([
				'baseColor'
			]),
		},
		onPageScroll(e) {
			if (e.scrollTop > 20) {
				this.backgroundColor = "#AED0FC"
			} else {
				this.backgroundColor = "#ffffff00"
			}
		},
		onShow() {

		},
		onLoad(e) {
			this.userinfo=uni.getStorageSync('userinfo')
			// this.loadData()
		},
		//下拉刷新
		onPullDownRefresh() {


		},
		//加载更多
		onReachBottom() {

		},
		onPageScroll(e) {
			// if (e.scrollTop > 20) {
			// 	this.backgroundColor = "#FBF9FF"
			// } else {
			// 	this.backgroundColor = "#ffffff00"
			// }
		},
		methods: {
			tabbarClick(e) {
				if (e == 1) {
					uni.reLaunch({
						url: '/pages/index/index'
					})
				}
				if (e == 2) {
					uni.reLaunch({
						url: '/pages/record/record'
					})
				}
				if (e == 3) {
					uni.reLaunch({
						url: '/pages/my/my'
					})
				}
			},
			settingsClick(){
				console.log('settings')
			uni.navigateTo({
				url:'/pages/my/settings'
			})	
			},
			buttonClick(){
				uni.navigateTo({
					url:'/pages/login/login'
				})
			},
			loadData() {

				var data = {
					id: this.id
				}
				forum_list(data).then(res => {
					this.list = res.data.data
				})
			},


		}
	}
</script>

<style lang="scss">
	.infoView{
		margin: 30rpx;
		padding: 40rpx 30rpx;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
	}
	.header{
		margin-top: -130rpx;
		width: 160rpx;
		height: 160rpx;
		background: #E3F1FE;
		border-radius: 50%;
		border: 4rpx solid #FFFFFF;
	}
	.name{
		margin: 30rpx 0;
		font-weight: 500;
		font-size: 36rpx;
		color: #333333;
	}
	.item1{
		height: 96rpx;
	}
	.left{
		font-weight: 500;
		font-size: 30rpx;
		color: #333333;
	}
	.right{
		font-weight: 500;
		font-size: 30rpx;
		color: #B7B7B7;
	}
	.button{
		margin: 60rpx 30rpx;
		height: 96rpx;
		background: #FFFFFF;
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		font-weight: 400;
		font-size: 30rpx;
		color: #333333;
	}
</style>